class CircleJoinItem extends ComponentEx {
    constructor() {
        super();
        this.skinName = "CircleJoinItemSkin";
    }
    //进入圈子_按钮
    btn_in: eui.Group;
    //玩家名字_文字
    lab_name: eui.Label;
    //圈子_文字
    lab_quan: eui.Label;
    //圈子ID_文字
    lab_id: eui.Label;
    //人数_文字
    lab_ren: eui.Label;

    parentDialog: any;

    childrenCreated() {

        super.childrenCreated();
        ButtonEx.draw(this.btn_in);
        this.btn_in.addEventListener(egret.TouchEvent.TOUCH_TAP, this.click_in, this);
    }
    //点击进入圈子
    click_in() {


        var send: any;

        switch (this.skinState) {

            case "list": // 进入圈子 按钮
                send =
                    {
                        id: this.data.id,
                        uid: game.player.uid,
                        owner_uid: this.data.owner_uid
                    };
                Circle.args_2015 = send;
                Circle.tosave_2015 = true;
                Circle.circle_send(2015, send);
                break;
            case "result": // 申请加入 按钮
                send =
                    {
                        id: this.data.id,
                        uid: game.player.uid,
                    };
                Circle.circle_send(2014, send);
                break;
        }


    }
    update(state: string, data: any) {
        this.skinState = state;
        if (!data) return;
        this.data = data;
        this.lab_name.text = data.name;
        this.lab_quan.text = data.owner_uid == game.player.uid ? "(我的)" : "";
        this.lab_id.text = "圈子ID：" + data.id;
        this.lab_ren.text = "人数：" + data.pernum;
    }
}